/**
 * Copyright &copy; 2016-2017 <a href="http://git.oschina.net/whoamien/backend_management">Backend Management</a> All rights reserved.
 */
package com.xw.app.imageupload;

import java.io.IOException;
import java.util.Properties;

/**
 * The Class OSSConfigure.
 *
 * @author Xi Wei
 */
public class OSSConfigure {

	private String endpoint;
	private String accessKeyId;
	private String accessKeySecret;
	private String bucketName;
	private String accessUrl;

	/**
	 * OSS configure.
	 */
	public OSSConfigure() {

	}

	/**
	 * 通过配置文件.properties文件获取，这几项内容。
	 *
	 * @param storageConfName the storage conf name
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	public OSSConfigure(String storageConfName) throws IOException {

		Properties prop = new Properties();
		prop.load(this.getClass().getClassLoader().getResourceAsStream(storageConfName));

		endpoint = prop.getProperty("endpoint").trim();
		accessKeyId = prop.getProperty("accessKeyId").trim();
		accessKeySecret = prop.getProperty("accessKeySecret").trim();
		bucketName = prop.getProperty("bucketName").trim();
		accessUrl = prop.getProperty("accessUrl").trim();

	}

	/**
	 * Instantiates a new OSSConfigure.
	 *
	 * @param endpoint the endpoint
	 * @param accessKeyId the access key id
	 * @param accessKeySecret the access key secret
	 * @param bucketName the bucket name
	 * @param accessUrl the access url
	 */
	public OSSConfigure(String endpoint, String accessKeyId, String accessKeySecret, String bucketName,
			String accessUrl) {

		this.endpoint = endpoint;
		this.accessKeyId = accessKeyId;
		this.accessKeySecret = accessKeySecret;
		this.bucketName = bucketName;
		this.accessUrl = accessUrl;
	}

	/**
	 * Gets the endpoint.
	 *
	 * @return the endpoint
	 */
	public String getEndpoint() {
		return endpoint;
	}

	/**
	 * Sets the endpoint.
	 *
	 * @param endpoint the new endpoint
	 */
	public void setEndpoint(String endpoint) {
		this.endpoint = endpoint;
	}

	/**
	 * Gets the access key id.
	 *
	 * @return the access key id
	 */
	public String getAccessKeyId() {
		return accessKeyId;
	}

	/**
	 * Sets the access key id.
	 *
	 * @param accessKeyId the new access key id
	 */
	public void setAccessKeyId(String accessKeyId) {
		this.accessKeyId = accessKeyId;
	}

	/**
	 * Gets the access key secret.
	 *
	 * @return the access key secret
	 */
	public String getAccessKeySecret() {
		return accessKeySecret;
	}

	/**
	 * Sets the access key secret.
	 *
	 * @param accessKeySecret the new access key secret
	 */
	public void setAccessKeySecret(String accessKeySecret) {
		this.accessKeySecret = accessKeySecret;
	}

	/**
	 * Gets the bucket name.
	 *
	 * @return the bucket name
	 */
	public String getBucketName() {
		return bucketName;
	}

	/**
	 * Sets the bucket name.
	 *
	 * @param bucketName the new bucket name
	 */
	public void setBucketName(String bucketName) {
		this.bucketName = bucketName;
	}

	/**
	 * Gets the access url.
	 *
	 * @return the access url
	 */
	public String getAccessUrl() {
		return accessUrl;
	}

	/**
	 * Sets the access url.
	 *
	 * @param accessUrl the new access url
	 */
	public void setAccessUrl(String accessUrl) {
		this.accessUrl = accessUrl;
	}
}
